package com.zkrt.upms.common.scheduler;

import com.zkrt.upms.common.component.UploadService;
import com.zkrt.upms.service.IUpDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 定时业务
 */
@Slf4j
@Component
public class UploadTaskScheduler {

//    @Autowired
//    private UploadService uploadService;

    @Autowired
    private IUpDataService upDataService;

    @Scheduled(cron = "${sendtask.job.cron}")
    public void executeSend() {
        log.info("\n\n[定时推送开始] -> {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//        uploadService.doit(); // 获取SFS增殖站的水质数据并上报
        upDataService.upload2Tcp();
        log.info("\n[定时推送结束] -> {}\n", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }

}
